<?php
class Pxy_kcset_ctl extends Ctl{
    function __construct(){
    }
    function main(array $xxfget) {
        $this::sessver();
        $type=!empty($_POST['type'])?$_POST['type']:false;
        if(!$type){
            $pid=$xxfget['pid'];
        	$result=xdb::getInstance()->getarray('select * from peixunkecheng');
        	$this::show('pxy_kcset',compact('result','pid'));
        }elseif ($type=="add"){
        	$array=array();
        	$array2=array();
        	$kname = $_POST['kname'];
        	$keshi = $_POST['keshi'];
        	$ktype = $_POST['ktype'];
        	$jiaocai = $_POST['jiaocai'];
        	$array['kname'] = $kname;
        	$array['keshi'] = $keshi;
        	$array['ktype'] = $ktype;
        	$array['jiaocai'] = $jiaocai;
        	$array2['kname']=$kname;
        	$array2['keshi'] = $keshi;
        	$array2['ktype'] = $ktype;
        	$array2['jiaocai'] = $jiaocai;
        	echo xdb::getInstance()->indb('peixunkecheng', $array, $array2);
        }elseif ($type=="del"){
        	$array=array();
        	$id=$_POST['pid'];
        	$array['id']=$id;
        	echo xdb::getInstance()->deldb('peixunkecheng', $array);
        }
    }
}